import cv2
import matplotlib.pyplot as plt
img_gray  = cv2.imread("../images/flower.png",cv2.IMREAD_GRAYSCALE)
thresh_mean = cv2.adaptiveThreshold(
    img_gray,
    maxValue= 255,
    adaptiveMethod = cv2.ADAPTIVE_THRESH_MEAN_C,
    thresholdType =  cv2.THRESH_BINARY,
    blockSize= 3,
    C = 2
)
thresh_gaussian = cv2.adaptiveThreshold(
    img_gray,
    maxValue=255,
    adaptiveMethod = cv2.ADAPTIVE_THRESH_GAUSSIAN_C,
    thresholdType = cv2.THRESH_BINARY,
    blockSize= 3 ,
    C =2
 )

plt.subplot(131), plt.imshow(img_gray, cmap="gray"), plt.axis("off")
plt.subplot(132), plt.imshow(thresh_mean, cmap="gray"), plt.axis("off")
plt.subplot(133), plt.imshow(thresh_gaussian, cmap="gray"), plt.axis("off")
plt.show()

